#pragma once
#include "DJoint.h"

namespace Skill
{
	namespace Ode
	{
		ref class DWorld;
		ref class DVector3;
		namespace Joints
		{
			ref class DJointGroup;
			public ref class DPrismaticRotoide : DJoint
			{
			protected:
				virtual void CollectManagedMemory() override;
			public:
				
				///<summary>
				/// Create a new joint of the PR (Prismatic and Rotoide) type.
				///</summary>
				///<param name = "world"> Wrold </param>
				///<param name = "group">
				/// set to null to allocate the joint normally.
				/// If it is valid the joint is allocated in the given joint group.
				///</param>				
				DPrismaticRotoide(DWorld^ world , DJointGroup^ group);


				///<summary>
				/// Gets or set the joint anchor point, in world coordinates.
				///</summary>
				///<returns> 
				/// the point on body 1. If the joint is perfectly satisfied, 
				/// this will be the same as the point on body 2.
				///</returns>
				REF_PROP_DECLARATION_GETSET(DVector3,Anchor);
				
				///<summary>
				/// Gets or set the axis for the prismatic articulation
				///</summary>
				REF_PROP_DECLARATION_GETSET(DVector3,Axis1);

				///<summary>
				/// Gets or set the axis for the rotoide articulation
				///</summary>
				REF_PROP_DECLARATION_GETSET(DVector3,Axis2);

				///<summary>
				/// set joint parameter
				///</summary>
				void SetParam(DJointParameters parameter, dReal value);	

				///<summary>
				/// Get joint parameter
				///</summary>
				dReal GetParam(DJointParameters parameter);

				///<summary>
				/// Applies the torque about the rotoide axis of the PR joint
				///
				/// That is, it applies a torque with specified magnitude in the direction 
				/// of the rotoide axis, to body 1, and with the same magnitude but in opposite
				/// direction to body 2. This function is just a wrapper for dBodyAddTorque()}
				///</summary>
				void AddTorque(dReal torque);				

				///<summary>
				/// Get the PR linear position (i.e. the prismatic's extension)
				///
				/// When the axis is set, the current position of the attached bodies is
				/// examined and that position will be the zero position.
				///
				/// The position is the "oriented" length between the
				/// position = (Prismatic axis) dot_product [(body1 + offset) - (body2 + anchor2)]
				///</summary>				
				VALUE_PROP_DECLARATION_GET(dReal,Position);

				///<summary>
				/// Get the PR linear position's time derivative				
				///</summary>				
				VALUE_PROP_DECLARATION_GET(dReal,PositionRate);
							
			};
		}
	}
}